package at.ac.lbg.media.vis.client.theme.manager
{
	import flare.vis.Visualization;
	
	import flash.printing.PrintJob;
	import flash.printing.PrintJobOptions;
	
	import mx.controls.List;
	import mx.core.UIComponent;
	import mx.printing.FlexPrintJob;
	import mx.printing.FlexPrintJobScaleType;
	
	public class PrintManager
	{
		public function PrintManager()
		{
		}
		
		
		public function printFlex(obj:UIComponent):void {
			var printJob:FlexPrintJob = new FlexPrintJob();
			if (printJob.start()) {
				obj.width = printJob.pageWidth;
				obj.height = printJob.pageHeight;
				printJob.addObject(obj, FlexPrintJobScaleType.MATCH_WIDTH);
				printJob.send();
			}
		}
		
		public function printViz(viz:Visualization):void {
			var printJob:PrintJob = new PrintJob();
			if (printJob.start()) {
				//viz.width = printJob.pageWidth;
				//viz.height = printJob.pageHeight;
				//viz.update();
				var options:PrintJobOptions = new PrintJobOptions(false);
				printJob.addPage(viz, null, options);
				printJob.send();
			}
		}
		
		public function printLegend(legend:List):void {
			var printJob:PrintJob = new PrintJob();
			if (printJob.start()) {
				var options:PrintJobOptions = new PrintJobOptions(false);
				printJob.addPage(legend, null, options);
				printJob.send();
			}
		}

	}
}